Skip to content

[IMP] fs_attachment: simplify domain for attachment search by skipping res_field checks#585

Open
CRogos wants to merge 1 commit intoOCA:18.0from
c4a8-odoo:18.0-imp-ir_attachment-query
Open

[IMP] fs_attachment: simplify domain for attachment search by skipping res_field checks#585
CRogos wants to merge 1 commit intoOCA:18.0from
c4a8-odoo:18.0-imp-ir_attachment-query

Conversation

@CRogos
Copy link
Copy Markdown
Contributor

@CRogos CRogos commented Apr 1, 2026

@lmignon what do you think on this change? Shouldn't this bypass this check as intended?

https://github.com/odoo/odoo/blob/18.0/odoo/addons/base/models/ir_attachment.py#L531-L535

PS: I haven't tested it yet, therefor draft. Tests are green.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @lmignon,
some modules you are maintaining are being modified, check this out!

@CRogos CRogos force-pushed the 18.0-imp-ir_attachment-query branch from 9b29992 to b0f48ca Compare April 1, 2026 14:04
Comment on lines 313 to +320
domain = [
("fs_storage_id", "in", self.ids),
"|",
("res_field", "=", False),
("res_field", "!=", False),
]
attachments = self.env["ir.attachment"].search(domain)
attachments = (
self.env["ir.attachment"]
.with_context(skip_res_field_check=True)
.search(domain)
)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CRogos CRogos marked this pull request as ready for review April 3, 2026 09:23
@lmignon
Copy link
Copy Markdown
Contributor

lmignon commented Apr 10, 2026

LGTM bu should be tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants